package cn.dai.SocketProgramming;

import java.net.URL;

/**
 * @author ArkD42
 * @file 1 - Java基础语法
 * @create 2020 - 04 - 22 - 21:31
 */
public class URL_Test {
    public static void main(String[] args) throws Exception {
        String url = "https://www.ygo-sem.cn/photo/story-430.aspx";

        URL url_link = new URL(url);

        System.out.println("协议名：" + url_link.getProtocol());
        System.out.println("主机名：" + url_link.getHost());
        System.out.println("端口号：" + url_link.getPort()); // -1 表示未获取到
        System.out.println("文件路径：" + url_link.getPath());
        System.out.println("文件名：" + url_link.getFile());
        System.out.println("查询名：" + url_link.getQuery());
    }
}
